/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xenon3d;

/**
 * Interface for mixed mode rendering. In mixed mode, the Xenon3D renderer is
 * running continuously, rendering the scene graph into the canvas. At certain
 * points in the rendering loop, the callback methods of the RenderListener
 * interface are called. Application wishing to perform their own operations at
 * these points, should implement the RenderListener interface and register
 * themselves with a View3D object.
 *
 * @author Volker Everts
 * @version 0.1 - 16.08.2011: Created
 */
public interface RenderListener {

    /**
     * Called by Xenon3D immediately after the OpenGL context is initialized.
     * Applications that wish to perform operations before the start of the
     * rendering loop, may override this method.
     */
    public void init();

    /**
     * Called by Xenon3D at the begin of the rendering loop, after clearing the
     * canvas and before any rendering has been done for this frame. Applications
     * that wish to perform operations in the rendering loop, prior to any actual
     * rendering, may override this method.
     */
    public void preRender();

    /**
     * Called by Xenon3D during the execution of the rendering loop. This method
     * is called right after the solid rendering pass and before the transparent
     * rendering pass. Furthermore, it is called once for each field (i.e., once
     * per frame on a mono system or once each for the right eye and left eye on
     * a two-pass stereo system. This is intended for use by applications that
     * want to mix retained/compiled-retained mode rendering with some immediate
     * mode rendering. Applications that wish to perform operations during the
     * rendering loop, may override this method.
     */
    public void render();

    /**
     * Called by Xenon3D at the end of each rendering loop after completing all
     * rendering to the canvas for this frame and before the buffer swap.
     * Applications that wish to perform operations in the rendering loop,
     * following any actual rendering may override this function.
     */
    public void postRender();

    /**
     * Called by Xenon3D during the first repaint after the Canvas3D has been
     * resized. The client can update certain settings appropriately. Note that
     * for convenience the component has already called glViewport(x, y, width,
     * height) when this method is called, so the client may not have to do
     * anything in this method. Applications that wish to perform operations in
     * case of the resizing of the Canvas3D may override this method.
     * @param width the new viewport width
     * @param height the new viewport height
     */
    public void reshape(int width, int height);

    /**
     * Called by Xenon3D when the display mode or the display device associated
     * with this Canvas3D has changed, or when the library is to shut down.
     * Applications that wish to perform operations in one of these cases, may
     * override this method.<p>
     * NOTE: Applications should not call this method.
     */
    public void dispose();

} // end interface RenderListener